<template>
	<view class="detail">
		<uni-card v-for="item in detail" :key="item.integralDetailId">
			<view v-if="item.channelName">获取渠道:{{item.channelName}}</view>
			<view v-if="item.consumeChannelName">消费渠道:{{item.consumeChannelName}}</view>
			<view>积分数:{{item.integralNum}}</view>
			<view>时间:{{item.createTime}}</view>
		</uni-card>
	</view>
</template>

<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue'
	import {
		getIntegralDetail
	} from '@/service/modules/personal';

	const detail = ref([{
			"integralDetailId": 1,
			"userId": 5,
			"channelName": "签到",
			"integralNum": 10,
			"consumeChannelName": null,
			"createTime": "2023-06-20 23:11:03"
		},
		{
			"integralDetailId": 4,
			"userId": 5,
			"channelName": "",
			"integralNum": -20,
			"consumeChannelName": "消费卷兑换",
			"createTime": "2023-06-23 23:11:03"
		}
	])

	onLoad(() => {
		getDetail()
	})

	const getDetail = async () => {
		const res = await getIntegralDetail()
		if (res.data.length > 0) {
			detail.value = res.data
		}
	}
</script>

<style lang="scss">

</style>